package com.example.springboot.controller;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
/* import org.springframework.web.bind.annotation.RequestMethod;*/
import org.springframework.web.bind.annotation.RestController;

import com.example.springboot.common.Result;

@RestController

public class WebController {
    @RequestMapping()
    public Result hello(String name) {
        return Result.success(name); 
    };
    @RequestMapping("/hello2")
    public Result hello2(String name) {
        return Result.success(name); 
    };
    @PostMapping("/post") // 新增
    public Result post(@RequestBody Obj obj) {
        return Result.success(obj); 
    };
    @PutMapping("/put") // 修改
    public Result put(@RequestBody Obj obj) {
        return Result.success(obj);
    };
    @DeleteMapping("/delete/{id}") // 删除
    public Result delete(@PathVariable Integer id) {
        return Result.success(id);
    }

}
